@using Variant = MudBlazor.Variant
@using Elsa.Studio.Models
@inherits StudioComponentBase

<ScrollableWell MaxHeight="VisiblePaneHeight">
    @if (JournalEntry != null!)
    {
        var record = JournalEntry.Record;
        var payload = ParsePayload(record.Payload);

        var eventInfo = new Dictionary<string, DataPanelItem>
        {
            ["Name"] = new(record.EventName),
            ["Timestamp"] = new(record.Timestamp.ToString("s")),
            ["Message"] = new(record.Message)
        };

        Merge(eventInfo, payload);
        
        <div class="pa-4">
            <MudStack>
                <div>
                    <MudText Typo="Typo.overline" GutterBottom="true" Align="Align.Left">Event</MudText>
                    <DataPanel Data="eventInfo" HideEmptyValues="true"/>
                </div>
            </MudStack>
        </div>
    }
</ScrollableWell>